<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .box {
            width: 322px;
            position: fixed;
            bottom: 0;
            right: 0;
            overflow: hidden;
        }
        
        span {
            position: absolute;
            top: 0;
            right: 0;
            width: 30px;
            height: 20px;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div class="box" id="box">
        <span id="closeButton"></span>

        <div class="hd" id="headPart">
            <img src="images/t.jpg" alt="" />
        </div>
        <div class="bd" id="bottomPart">
            <img src="images/b.jpg" alt="" />
        </div>
    </div>
    <script src="animate.js" type="text/javascript"></script>
    <script>
    //找dom对象
    var closeButton = document.getElementById("closeButton");
    var bottomPart = document.getElementById("bottomPart");
    var box = document.getElementById("box");
    //点击closeButton让bottomPart的高度渐渐地变为零然后让整个盒子的宽度变为零
    closeButton.onclick = function () {
        animate(bottomPart, {"height": 0}, function () {
            animate(box, {"width": 0});
        });
    }


</script>
</body>

</html>